<Query Kind="Statements">
  <NuGetReference>SharpSvn</NuGetReference>
  <Namespace>SharpSvn</Namespace>
  <Namespace>System.Net</Namespace>
</Query>

using SvnClient _client = new SvnClient();
NetworkCredential _credential = new("Administrator", "sicont_server");

_client.Authentication.Clear();
_client.Authentication.DefaultCredentials = _credential;
_client.Authentication.SslServerTrustHandlers += (sender, e) =>
{
    e.AcceptedFailures = e.Failures;
    e.Save = true;
};

string _remote_repository = "https://Vc2000/svn/Test";
string _local_repository = "D:\\WorkSpace";

SvnPathTarget _local_target = new(_local_repository);
SvnUriTarget _remote_target = new(_remote_repository);

/**************************************************************************************/
_client.Notify += (_, e) => { e.Dump(); };
_client.SvnError += (_, e) => { $"SvnError: {e.Exception.Message}".Dump(); };
// note: 执行 Svn Process 时触发回调
_client.Processing += (_, e) => { $"SvnProcess: {e.CommandType}".Dump(); };
_client.Committing += (_, e) => { e.Dump(); };
_client.Committed += (_, e) => { e.Dump(); };
_client.Conflict += (_, e) => { e.Dump(); };
int _count = 0;
//_client.Progress += (_, e) => { e.Dump(); };
//_client.Cancel += (_, e) => { e.Dump(); };

/**************************************************************************************/

// note: 测试 GetList

SvnListArgs _list_args = new() { Depth = SvnDepth.Infinity };
//_list_args.List += (_, e) => { e.Path.Dump(); };
_client.GetList(_remote_target, _list_args, out var _list);
//_list.Select(x => x.Path).Dump();
// result: 104 项

// note: 测试 GetInfo
SvnInfoArgs _info_args = new() 
{
    Depth = SvnDepth.Children,
};
_client.GetInfo(_remote_target, _info_args, out var _remote_info);
//_remote_info.Dump();
_client.GetInfo(_local_target, _info_args, out var _local_info);
//_local_info.Dump();


// Todo: GetChangeList 暂时没明白有什么用

// note: 测试 GetStatus
SvnStatusArgs _status_args = new() {RetrieveRemoteStatus = true };
//_status_args.Dump();
_client.GetStatus(_local_repository, _status_args, out var _status_list);
//_status_list.Dump();

//SvnCommitArgs _commit_args = new() { LogMessage = "测试"};
//_client.Commit(_local_repository, _commit_args);

string _remote_repository1 = "https://Vc2000/svn/Test/2021_南通通富_多功能机械手";
SvnUriTarget _remote_target1 = new(_remote_repository);

SvnInfoArgs _list_args1 = new() { Depth = SvnDepth.Infinity };
_client.GetInfo(_remote_target1, _list_args1, out var _list1);
_list1.Dump();